import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('file_setting')
export class FileSetting {
  @PrimaryGeneratedColumn({
    name: 'setting_id',
    type: 'int',
    comment: '设置id',
  })
  settingId: number;

  @Column({
    name: 'is_upload_admin',
    type: 'tinyint',
    default: 1,
    comment: '后台文件上传是否开启，1是0否',
  })
  isUploadAdmin: number;

  @Column({
    name: 'is_upload_api',
    type: 'tinyint',
    default: 1,
    comment: '前台文件上传是否开启，1是0否',
  })
  isUploadApi: number;

  @Column({
    name: 'storage',
    type: 'varchar',
    length: 11,
    default: 'local',
    comment: '存储方式：local本地(服务器)，qiniu七牛云Kodo，aliyun阿里云OSS，tencent腾讯云COS，upyun又拍云USS，huawei华为云OBS，aws AWS S3',
  })
  storage: string;

  // 七牛云配置
  @Column({
    name: 'qiniu_access_key',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '七牛云Kodo，AccessKey',
  })
  qiniuAccessKey: string;

  @Column({
    name: 'qiniu_secret_key',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '七牛云Kodo，SecretKey',
  })
  qiniuSecretKey: string;

  @Column({
    name: 'qiniu_bucket',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '七牛云Kodo，空间名称',
  })
  qiniuBucket: string;

  @Column({
    name: 'qiniu_domain',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '七牛云Kodo，访问域名',
  })
  qiniuDomain: string;

  // 阿里云OSS配置
  @Column({
    name: 'aliyun_access_key_id',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '阿里云OSS，AccessKey ID',
  })
  aliyunAccessKeyId: string;

  @Column({
    name: 'aliyun_access_key_secret',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '阿里云OSS，AccessKey Secret',
  })
  aliyunAccessKeySecret: string;

  @Column({
    name: 'aliyun_bucket',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '阿里云OSS，Bucket 名称',
  })
  aliyunBucket: string;

  @Column({
    name: 'aliyun_endpoint',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '阿里云OSS，Endpoint（地域节点）',
  })
  aliyunEndpoint: string;

  @Column({
    name: 'aliyun_domain',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '阿里云OSS，Bucket 域名',
  })
  aliyunDomain: string;

  // 腾讯云COS配置
  @Column({
    name: 'tencent_secret_id',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '腾讯云COS，SecretId',
  })
  tencentSecretId: string;

  @Column({
    name: 'tencent_secret_key',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '腾讯云COS，SecretKey',
  })
  tencentSecretKey: string;

  @Column({
    name: 'tencent_bucket',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '腾讯云COS，存储桶名称',
  })
  tencentBucket: string;

  @Column({
    name: 'tencent_region',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '腾讯云COS，所属地域',
  })
  tencentRegion: string;

  @Column({
    name: 'tencent_domain',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '腾讯云COS，访问域名',
  })
  tencentDomain: string;

  // 百度云BOS配置
  @Column({
    name: 'baidu_access_key',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '百度云BOS，AccessKey',
  })
  baiduAccessKey: string;

  @Column({
    name: 'baidu_secret_key',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '百度云BOS，SecretKey',
  })
  baiduSecretKey: string;

  @Column({
    name: 'baidu_bucket',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '百度云BOS，Bucket 名称',
  })
  baiduBucket: string;

  @Column({
    name: 'baidu_endpoint',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '百度云BOS，所属地域',
  })
  baiduEndpoint: string;

  @Column({
    name: 'baidu_domain',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '百度云BOS，官方域名',
  })
  baiduDomain: string;

  // 又拍云USS配置
  @Column({
    name: 'upyun_service_name',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '又拍云USS，服务名称',
  })
  upyunServiceName: string;

  @Column({
    name: 'upyun_operator_name',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '又拍云USS，操作员',
  })
  upyunOperatorName: string;

  @Column({
    name: 'upyun_operator_pwd',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '又拍云USS，操作员密码',
  })
  upyunOperatorPwd: string;

  @Column({
    name: 'upyun_domain',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '又拍云USS，加速域名',
  })
  upyunDomain: string;

  // 华为云OBS配置
  @Column({
    name: 'huawei_access_key_id',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '华为云OBS，Access Key ID',
  })
  huaweiAccessKeyId: string;

  @Column({
    name: 'huawei_secret_access_key',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '华为云OBS，Access Key Secret',
  })
  huaweiSecretAccessKey: string;

  @Column({
    name: 'huawei_bucket',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '华为云OBS，桶名称',
  })
  huaweiBucket: string;

  @Column({
    name: 'huawei_endpoint',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '华为云OBS，Endpoint(地域节点）',
  })
  huaweiEndpoint: string;

  @Column({
    name: 'huawei_domain',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '华为云OBS，访问域名',
  })
  huaweiDomain: string;

  // AWS S3配置
  @Column({
    name: 'aws_access_key_id',
    type: 'varchar',
    length: 255,
    default: '',
    comment: 'AWS S3，access KEY ID',
  })
  awsAccessKeyId: string;

  @Column({
    name: 'aws_secret_access_key',
    type: 'varchar',
    length: 255,
    default: '',
    comment: 'AWS S3，secret access KEY',
  })
  awsSecretAccessKey: string;

  @Column({
    name: 'aws_bucket',
    type: 'varchar',
    length: 255,
    default: '',
    comment: 'AWS S3，Bucket 名称',
  })
  awsBucket: string;

  @Column({
    name: 'aws_region',
    type: 'varchar',
    length: 255,
    default: '',
    comment: 'AWS S3，Region 区域',
  })
  awsRegion: string;

  @Column({
    name: 'aws_endpoint',
    type: 'varchar',
    length: 255,
    default: '',
    comment: 'AWS S3，Endpoint 端点',
  })
  awsEndpoint: string;

  @Column({
    name: 'aws_domain',
    type: 'varchar',
    length: 255,
    default: '',
    comment: 'AWS S3，Bucket 域名',
  })
  awsDomain: string;

  // 文件上传限制配置
  @Column({
    name: 'image_ext',
    type: 'varchar',
    length: 255,
    default: 'jpg,png,jpeg,ico',
    comment: '允许上传的图片后缀，多个逗号","隔开',
  })
  imageExt: string;

  @Column({
    name: 'image_size',
    type: 'varchar',
    length: 11,
    default: '1',
    comment: '允许上传的图片大小，单位MB',
  })
  imageSize: string;

  @Column({
    name: 'video_ext',
    type: 'varchar',
    length: 255,
    default: 'mp4,avi,mkv,flv',
    comment: '允许上传的视频后缀，多个逗号","隔开',
  })
  videoExt: string;

  @Column({
    name: 'video_size',
    type: 'varchar',
    length: 11,
    default: '50',
    comment: '允许上传的视频大小，单位MB',
  })
  videoSize: string;

  @Column({
    name: 'audio_ext',
    type: 'varchar',
    length: 255,
    default: 'mp3,aac,wav',
    comment: '允许上传的音频后缀，多个逗号","隔开',
  })
  audioExt: string;

  @Column({
    name: 'audio_size',
    type: 'varchar',
    length: 11,
    default: '10',
    comment: '允许上传的音频大小，单位MB',
  })
  audioSize: string;

  @Column({
    name: 'word_ext',
    type: 'varchar',
    length: 255,
    default: 'doc,docx,xls,xlsx,ppt,pptx',
    comment: '允许上传的文档后缀，多个逗号","隔开',
  })
  wordExt: string;

  @Column({
    name: 'word_size',
    type: 'varchar',
    length: 11,
    default: '5',
    comment: '允许上传的文档大小，单位MB',
  })
  wordSize: string;

  @Column({
    name: 'other_ext',
    type: 'varchar',
    length: 255,
    default: 'zip,rar',
    comment: '允许上传的其它文件后缀，多个逗号","隔开',
  })
  otherExt: string;

  @Column({
    name: 'other_size',
    type: 'varchar',
    length: 11,
    default: '30',
    comment: '允许上传的其它文件大小，单位MB',
  })
  otherSize: string;

  @Column({
    name: 'limit_max',
    type: 'int',
    width: 10,
    default: 9,
    comment: '允许上传最大文件个数（每次）',
  })
  limitMax: number;

  @Column({
    name: 'is_api_file',
    type: 'tinyint',
    default: 0,
    comment: '是否开启前台文件功能，1是0否',
  })
  isApiFile: number;

  @Column({
    name: 'api_file_types',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '前台文件功能允许的文件类型',
  })
  apiFileTypes: string;

  @Column({
    name: 'api_file_group_ids',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '前台文件功能允许的分组ID',
  })
  apiFileGroupIds: string;

  @Column({
    name: 'api_file_tag_ids',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '前台文件功能允许的标签ID',
  })
  apiFileTagIds: string;

  @Column({
    name: 'create_uid',
    type: 'int',
    default: 0,
    comment: '添加用户id',
  })
  createUid: number;

  @Column({
    name: 'update_uid',
    type: 'int',
    default: 0,
    comment: '修改用户id',
  })
  updateUid: number;

  @Column({
    name: 'create_time',
    type: 'datetime',
    nullable: true,
    comment: '添加时间',
  })
  createTime: Date;

  @Column({
    name: 'update_time',
    type: 'datetime',
    nullable: true,
    comment: '修改时间',
  })
  updateTime: Date;
}